package jk.spider.model;

import java.util.Date;
import java.util.List;

import org.apache.log4j.Logger;

import jk.spider.core.event.CoreEventVisitable;
import jk.spider.core.storage.Storage;
import jk.spider.util.SpiderUtil;

public class Resource {
	private static final Logger log = Logger.getLogger(Resource.class);
	private int rId;
	private int paId = 0;
	private String url;
	private String type;
	private int httpStatus;
	private byte[] bytes;
	private String dTime;
	private String contentType;
	private String kid;
	private int reqCount;
	
	private Folder folder;
	private ImgInfo imgInfo;
	private Sinfo sinfo;
	private ResInfo resInfo;
	private Storage storage;
	
	private List<Comments> comments;
	
	private String pHtmlSource;
	private String site;
	private String date;
	
	public Resource() {}
	
	public Resource(Storage storage, Folder folder ) {
		this.storage = storage;
		this.folder = folder;
	}
	
	public Resource(Storage storage, Folder folder, ImgInfo imgInfo ) {
		this.storage = storage;
		this.folder = folder;
		this.imgInfo = imgInfo;
	}
	
	public Sinfo getSinfo() {
		return sinfo;
	}

	public void setSinfo(Sinfo sinfo) {
		this.sinfo = sinfo;
	}

	public void setFolder(Folder folder) {
		this.folder = folder;
	}

	public void setImgInfo(ImgInfo imgInfo) {
		this.imgInfo = imgInfo;
	}
	
	public Resource(Storage storage, Folder folder, ImgInfo imgInfo, Sinfo sinfo ) {
		this.storage = storage;
		this.folder = folder;
		this.imgInfo = imgInfo;
		this.sinfo = sinfo;
	}
	
	public int getRId() {
		return rId;
	}
	public void setRId(int id) {
		rId = id;
	}
	public int getPaId() {
		return paId;
	}
	public void setPaId(int paId) {
		this.paId = paId;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
		
	}
	public int getHttpStatus() {
		return httpStatus;
	}
	public void setHttpStatus(int httpStatus) {
		this.httpStatus = httpStatus;
	}
	public String getDTime() {
		return dTime;
	}
	public void setDTime(String time) {
		this.dTime = time;
	}
	public byte[] getBytes() {
		return bytes;
	}
	public void setBytes(byte[] bytes) {
		this.bytes = bytes;
	}
	public String getContentType() {
		return contentType;
	}
	public void setContentType(String contentType) {
		this.contentType = contentType;
	}

	public Folder getFolder() {
		return folder;
	}

	public ImgInfo getImgInfo(Storage storage, int rid) {
		ImgInfo imgInfo = storage.getImgInfoDAO().findById(rid);
		return imgInfo;
	}

	public ResInfo getResInfo() {
		return resInfo;
	}

	public void setResInfo(ResInfo resInfo) {
		this.resInfo = resInfo;
	}

	public String getPHtmlSource() {
		return pHtmlSource;
	}

	public void setPHtmlSource(String htmlSource) {
		pHtmlSource = htmlSource;
	}

	public String getSite() {
		return site;
	}

	public void setSite(String site) {
		this.site = site;
	}

	public String getKid() {
		return kid;
	}

	public void setKid(String kid) {
		this.kid = kid;
	}

	public List<Comments> getComments() {
		return comments;
	}

	public void setComments(List<Comments> comments) {
		this.comments = comments;
	}

	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	public int getReqCount() {
		return reqCount;
	}

	public void setReqCount(int reqCount) {
		this.reqCount = reqCount;
	}
}
